home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / unix / sysv / irix4 / fcntlbits.h < prev    next >
C/C++ Source or Header  |  1994-05-10  |  4KB  |  99 lines

  1. /* O_*, F_*, FD_* bit values for SGI Irix 4.
  2. Copyright (C) 1994 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4.  
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version.
  9.  
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. Library General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Library General Public
  16. License along with the GNU C Library; see the file COPYING.LIB.  If
  17. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  18. Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef    _FCNTLBITS_H
  21.  
  22. #define    _FCNTLBITS_H    1
  23.  
  24.  
  25. /* File access modes for `open' and `fcntl'.  */
  26. #define    O_RDONLY    0    /* Open read-only.  */
  27. #define    O_WRONLY    1    /* Open write-only.  */
  28. #define    O_RDWR        2    /* Open read/write.  */
  29.  
  30.  
  31. /* Bits OR'd into the second argument to open.  */
  32. #define    O_CREAT        00400    /* Create file if it doesn't exist.  */
  33. #define    O_EXCL        02000    /* Fail if file already exists.  */
  34. #define    O_TRUNC        01000    /* Truncate file to zero length.  */
  35. #ifdef __USE_MISC
  36. #define    O_SYNC        00020    /* Synchronous writes.  */
  37. #define    O_ASYNC        00100    /* Send SIGIO to owner when data is ready.  */
  38. #endif
  39.  
  40. /* File status flags for `open' and `fcntl'.  */
  41. #define    O_APPEND    000010    /* Writes append to the file.  */
  42. #ifdef __USE_BSD
  43. #define    O_NDELAY    000004    /* Non-blocking I/O.  */
  44. #endif
  45. #define O_NONBLOCK    000200    /* POSIX.1 non-blocking I/O.  */
  46.  
  47. /* Mask for file access modes.  This is system-dependent in case
  48.    some system ever wants to define some other flavor of access.  */
  49. #define    O_ACCMODE    (O_RDONLY|O_WRONLY|O_RDWR)
  50.  
  51. /* Values for the second argument to `fcntl'.  */
  52. #define    F_DUPFD          0    /* Duplicate file descriptor.  */
  53. #define    F_GETFD        1    /* Get file descriptor flags.  */
  54. #define    F_SETFD        2    /* Set file descriptor flags.  */
  55. #define    F_GETFL        3    /* Get file status flags.  */
  56. #define    F_SETFL        4    /* Set file status flags.  */
  57. #define    F_GETLK        5    /* Get record locking info.  */
  58. #define    F_SETLK        6    /* Set record locking info.  */
  59. #define    F_SETLKW    7    /* Set record locking info, wait.  */
  60. #ifdef __USE_MISC
  61. #define F_CHKFL         8       /* Check legality of file flag changes.  */
  62. #define F_ALLOCSP       10
  63. #define F_FREESP        11
  64. #define F_SETBSDLK      12      /* Set Berkeley record lock.  */
  65. #define F_SETBSDLKW     13      /* Set Berkeley record lock and wait.  */
  66. #define F_RGETLK        20      /* Get info on a remote lock.  */
  67. #define F_RSETLK        21      /* Set or unlock a remote lock.  */
  68. #define F_RSETLKW       22      /* Set or unlock a remote lock and wait.  */
  69. #define F_GETOWN        10      /* Get owner; only works on sockets.  */
  70. #define F_SETOWN        11      /* Set owner; only works on sockets.  */
  71. #endif
  72.  
  73.  
  74. /* File descriptor flags used with F_GETFD and F_SETFD.  */
  75. #define    FD_CLOEXEC    1    /* Close on exec.  */
  76.  
  77.  
  78. #include <gnu/types.h>
  79.  
  80. /* The structure describing an advisory lock.  This is the type of the third
  81.    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
  82. struct flock
  83.   {
  84.     short int l_type;    /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
  85.     short int l_whence;    /* Where `l_start' is relative to (like `lseek').  */
  86.     __off_t l_start;    /* Offset where the lock begins.  */
  87.     __off_t l_len;    /* Size of the locked area; zero means until EOF.  */
  88.     short int l_sysid;    /* System ID where locking process resides. */
  89.     short int l_pid;    /* Process holding the lock.  */
  90.   };
  91.  
  92. /* Values for the `l_type' field of a `struct flock'.  */
  93. #define    F_RDLCK    1    /* Read lock.  */
  94. #define    F_WRLCK    2    /* Write lock.  */
  95. #define    F_UNLCK    3    /* Remove lock.  */
  96.  
  97.  
  98. #endif    /* fcntlbits.h */
  99.